package com.zhentao.controller;

import com.zhentao.login.service.TMenuService;
import com.zhentao.nlz.project.login.TMenu;
import com.zhentao.nlz.project.product.vo.MenuVo;
import com.zhentao.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("menu")
public class MenuController {
    @Autowired
    private TMenuService menuService;
    @GetMapping("/getmenu")
    public Result menus() {
        Result menu = menuService.getMenu();
        return Result.success(menu) ;
    }
    @GetMapping("/menus")
    public Result getmenus() {
        List<MenuVo> sysMenuVoList =  menuService.findUserMenuList() ;
        return Result.success(sysMenuVoList) ;
    }
    @PostMapping("savemenu")
    public Result saveMenu(TMenu menu){
        return Result.success(menuService.saveMenu(menu));
    }
    @PostMapping("updatemenu")
    public Result updateMenu(TMenu menu){
        return Result.success(menuService.updateMenu(menu));
    }
    @PostMapping("removemenu")
    public Result removeMenu(Integer menuId){
        return Result.success(menuService.removeMenu(menuId));
    }
}
